package com.forenow.demo.demo16.oop;

/**
 * 构造器（构造方法）
 *
 *
 */
public class ConstructorDemo {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public ConstructorDemo(String name, int age){
        this.name=name;
        this.age=age;
        //System.out.println("这是构造器。。。。");
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        ConstructorDemo constructorDemo=new ConstructorDemo("fender",45);
        System.out.println(constructorDemo.getName()+"---"+constructorDemo.getAge());
    }
}
